<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
    </head>
    <script src="index.js"></script>
    <style>
        .top {
            height: 100px;
        }
        .content {
            height: 500px;
            overflow: scroll;
        }
        
        h1 {
            height: 200px;
            position: relative;
            background-color: lightblue;
        }
        
        h1:after {
            content: '';
            position: absolute;
            top: 100px;
            left: 0;
            width: 100%;
            height: 2px;
            background-color: red;
        }
        #sticky-nav {
            position: sticky;
            /*position: absolute;*
            left: 0;*/
            top: 0;
            width: 100%;
            height: 80px;
            background-color: yellowgreen;
        }
        
        .scroll-container {
            height: 600px;
            width: 100%;
            background-color: lightgrey;
        }
    </style>
    <body>
        <div class="top">top</div>
        <div class="content">
            <h1>高200px;距顶部100px</h1>
            <p class="scroll-container">发生滚动</p>
            <div id="sticky-nav">这是一个tab切换栏，给sticky定位top=100px</div>
            <p class="scroll-container" style="background:lightgoldenrodyellow;">发生滚动</p>
        </div>
    </body>
</html>